package com.handz.test.config;

import com.handz.test.Interceptor.ReqInterceptor;
import com.handz.test.filter.DemoFilter;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.validation.constraints.DecimalMax;
import java.util.ArrayList;
import java.util.List;

/**
 * 应用模块名称<p>
 *
 * @author hepeiyun
 * @since 2019/11/5
 */

@Configuration
@Slf4j
@ConfigurationProperties(prefix = "noauth")
public class WebConfigurer  implements WebMvcConfigurer {

    @Getter
    @Setter
    private List<String> url = new ArrayList<>();

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(reqInterceptor()).addPathPatterns("/demo/**").excludePathPatterns(url);
    }

    @Bean
    public ReqInterceptor reqInterceptor(){return new ReqInterceptor();};

}
